Efficient sorting of large dimensional data

ABSTRACT

Various embodiments sort data. In one embodiment, a matrix D including a set of data values is received. A matrix Q is received, and includes a set of columns and a set of rows. The matrix Q further includes a sorting of each column of the matrix D. Each of these rows corresponds to a sorting. Each of a set of values in each of the set of columns in the matrix Q identifies a row in the matrix D. At least one sub-matrix D′ of the matrix D is identified. A set of columns of the sub-matrix D′ is restricted to one or more columns of the matrix D. A processor sorts the sub-matrix D′ by rows based on the sorting of the set of columns of the matrix D as given in the matrix Q, and based on the set of data values in the matrix D.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims priority from prior U.S.patent application Ser. No. 13/711,227, filed on Dec. 11, 2012, now U.S.Pat. No. ______, the entire disclosure of which is herein incorporatedby reference in its entirety.

BACKGROUND

The present invention generally relates to the field of data sorting,and more particularly relates to efficiently sorting large dimensionaldata.

Lexicographical sorting of databases (including restricted databases) isa fundamental problem with many applications. One important applicationis to quickly counting occurrences of a specific query in a largedatabase consisting of m records and n attributes. That is, if thedatabase, or restricted database, is lexicographically sorted then theoccurrences of specific entries can be quickly tallied. For example,suppose a database holds the weather (rain or no-rain), traffic (lightor heavy), and air quality (good or bad) for every day of the year for agiven city. An example query is to count the number of days it wasraining and where the air quality was bad. If the database was notsorted, a naive approach would be to examine each entry of the database(restricted to weather and air quality) and count the occurrences of thequery (rain and bad). Typically, the database is repeatedly queried andthis naive approach is not sufficient, especially where the database isqueried over a subset of the total features, i.e. a restriction of thedatabase.

BRIEF SUMMARY

In one embodiment, a computer implemented method for sorting data isdisclosed. The method includes receiving a matrix D including a set ofdata values is received. The matrix D includes a set of rows and a setof columns. A matrix Q is received, and includes a set of columns and aset of rows. The matrix Q further includes a sorting of each column ofthe matrix D, where each of the set of rows in the matrix Q correspondsto a sorting, and each of a set of values in each of the set of columnsin the matrix Q identifies a row in the matrix D. At least onesub-matrix D′ of the matrix D is identified. The at least one sub-matrixD′ includes a set of rows and a set of columns. The set of columns ofthe sub-matrix D′ is restricted to one or more columns of the matrix D.A processor sorts the at least one sub-matrix D′ by rows based on thesorting of the set of columns of the matrix D as given in the matrix Q,and based on the set of data values in the matrix D.

In another embodiment, an information processing system for sorting datais disclosed. The information processing system includes a memory and aprocessor that is communicatively coupled to the memory. A sortingmodule is communicatively coupled to the memory and the processor. Thesorting module is configured to perform a method. The method includesreceiving a matrix D including a set of data values is received. Thematrix D includes a set of rows and a set of columns. A matrix Q isreceived, and includes a set of columns and a set of rows. The matrix Qfurther includes a sorting of each column of the matrix D, where each ofthe set of rows in the matrix Q corresponds to a sorting, and each of aset of values in each of the set of columns in the matrix Q identifies arow in the matrix D. At least one sub-matrix D′ of the matrix D isidentified. The at least one sub-matrix D′ includes a set of rows and aset of columns. The set of columns of the sub-matrix D′ is restricted toone or more columns of the matrix D. A processor sorts the at least onesub-matrix D′ by rows based on the sorting of the set of columns of thematrix D as given in the matrix Q, and based on the set of data valuesin the matrix D.

In a further embodiment, a non-transitory computer program product forsorting data is disclosed. The computer program product includes astorage medium readable by a processing circuit and storing instructionsfor execution by the processing circuit for performing a method. Themethod includes receiving a matrix D including a set of data values isreceived. The matrix D includes a set of rows and a set of columns. Amatrix Q is received, and includes a set of columns and a set of rows.The matrix Q further includes a sorting of each column of the matrix D,where each of the set of rows in the matrix Q corresponds to a sorting,and each of a set of values in each of the set of columns in the matrixQ identifies a row in the matrix D. At least one sub-matrix D′ of thematrix D is identified. The at least one sub-matrix D′ includes a set ofrows and a set of columns. The set of columns of the sub-matrix D′ isrestricted to one or more columns of the matrix D. A processor sorts theat least one sub-matrix D′ by rows based on the sorting of the set ofcolumns of the matrix D as given in the matrix Q, and based on the setof data values in the matrix D.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The accompanying figures where like reference numerals refer toidentical or functionally similar elements throughout the separateviews, and which together with the detailed description below areincorporated in and form part of the specification, serve to furtherillustrate various embodiments and to explain various principles andadvantages all in accordance with the present invention, in which:

FIG. 1 is a block diagram illustrating one example of an operatingenvironment according to one embodiment of the present invention;

FIG. 2 illustrates a first example an input matrix that includes a setof data values according to one embodiment of the present invention;

FIG. 3 illustrates a first example of a sub-matrix of the input matrixin FIG. 2 according to one embodiment of the present invention;

FIG. 4 illustrates a second example of a sub-matrix of the input matrixin FIG. 2 according to one embodiment of the present invention;

FIG. 5 illustrates a third example of a sub-matrix of the input matrixin FIG. 2 according to one embodiment of the present invention;

FIG. 6 illustrates one example of a matrix comprising sortinginformation for each column of the input matrix in FIG. 2 according toone embodiment of the present invention;

FIG. 7 illustrates one example of pseudocode for sorting a sub-matrix ofa matrix according to one embodiment of the present invention;

FIG. 8 illustrates one example of pseudocode for refining a sorting ofone or more sub-matrices a matrix according to one embodiment of thepresent invention;

FIG. 9 illustrates one example of pseudocode for sorting multiplesub-matrices a matrix according to one embodiment of the presentinvention;

FIG. 10 shows a first example of a lexicographical sorting of the inputmatrix in FIG. 2 according to one embodiment of the present invention;

FIG. 11 shows a second example of a lexicographical sorting of the inputmatrix in FIG. 2 according to one embodiment of the present invention;

FIG. 12 illustrates one example of pseudocode for sorting allsub-matrices of a matrix over all permutations of columns according toone embodiment of the present invention; and

FIG. 13 is an operational flow diagram illustrating one example of aprocess for sorting data according to one embodiment of the presentinvention.

DETAILED DESCRIPTION

FIG. 1 illustrates a general overview of one operating environment 100according to one embodiment of the present invention. In particular,FIG. 1 illustrates an information processing system 102 that can beutilized in embodiments of the present invention. The informationprocessing system 102 shown in FIG. 1 is only one example of a suitablesystem and is not intended to limit the scope of use or functionality ofembodiments of the present invention described above. The informationprocessing system 102 of FIG. 1 is capable of implementing and/orperforming any of the functionality set forth above. Any suitablyconfigured processing system can be used as the information processingsystem 102 in embodiments of the present invention.

As illustrated in FIG. 1, the information processing system 102 is inthe form of a general-purpose computing device. The components of theinformation processing system 102 can include, but are not limited to,one or more processors or processing units 104, a system memory 106, anda bus 108 that couples various system components including the systemmemory 106 to the processor 104.

The bus 108 represents one or more of any of several types of busstructures, including a memory bus or memory controller, a peripheralbus, an accelerated graphics port, and a processor or local bus usingany of a variety of bus architectures. By way of example, and notlimitation, such architectures include Industry Standard Architecture(ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA)bus, Video Electronics Standards Association (VESA) local bus, andPeripheral Component Interconnects (PCI) bus.

The system memory 106, in one embodiment, includes a sorting module 109configured to perform one or more embodiments discussed below. Forexample, in one embodiment, the sorting module 109 is configured toperform one or more sorting operations on a database restricted to anyset of attributes. The sorting module 109 quickly sorts all possiblerestrictions by attributes, while requiring minimal memory resources.The sorting module 109 is discussed in greater detail below. It shouldbe noted that even though FIG. 1 shows the sorting module 109 residingin the main memory, the sorting module 109 can reside within theprocessor 104, be a separate hardware component, and/or be distributedacross a plurality of information processing systems and/or processors.

The system memory 106 can also include computer system readable media inthe form of volatile memory, such as random access memory (RAM) 110and/or cache memory 112. The information processing system 102 canfurther include other removable/non-removable, volatile/non-volatilecomputer system storage media. By way of example only, a storage system114 can be provided for reading from and writing to a non-removable orremovable, non-volatile media such as one or more solid state disksand/or magnetic media (typically called a “hard drive”). A magnetic diskdrive for reading from and writing to a removable, non-volatile magneticdisk (e.g., a “floppy disk”), and an optical disk drive for reading fromor writing to a removable, non-volatile optical disk such as a CD-ROM,DVD-ROM or other optical media can be provided. In such instances, eachcan be connected to the bus 108 by one or more data media interfaces.The memory 106 can include at least one program product having a set ofprogram modules that are configured to carry out the functions of anembodiment of the present invention.

Program/utility 116, having a set of program modules 118, may be storedin memory 106 by way of example, and not limitation, as well as anoperating system, one or more application programs, other programmodules, and program data. Each of the operating system, one or moreapplication programs, other program modules, and program data or somecombination thereof, may include an implementation of a networkingenvironment. Program modules 118 generally carry out the functionsand/or methodologies of embodiments of the present invention.

The information processing system 102 can also communicate with one ormore external devices 120 such as a keyboard, a pointing device, adisplay 122, etc.; one or more devices that enable a user to interactwith the information processing system 102; and/or any devices (e.g.,network card, modem, etc.) that enable computer system/server 102 tocommunicate with one or more other computing devices. Such communicationcan occur via I/O interfaces 124. Still yet, the information processingsystem 102 can communicate with one or more networks such as a localarea network (LAN), a general wide area network (WAN), and/or a publicnetwork (e.g., the Internet) via network adapter 126. As depicted, thenetwork adapter 126 communicates with the other components ofinformation processing system 102 via the bus 108. Other hardware and/orsoftware components can also be used in conjunction with the informationprocessing system 102. Examples include, but are not limited to:microcode, device drivers, redundant processing units, external diskdrive arrays, RAID systems, tape drives, and data archival storagesystems.

In one embodiment, the following framework is utilized by the sortingmodule 109. Let DεR^(m×n) be a real matrix where rows and columns areindexed by {0, . . . , m−1} and {0, . . . , n−1}, respectively. vεR^(n)Is less than wεR^(n) lexicographically, denoted v<_(lex)w, if v₀=w₀, . .. , v_(k)=w_(k) and v_(k+1)<w_(k+1) for some 0≦k<n−1. For example, [2,1, 3, 0]<_(lex) [2, 1, 5, −1]. If n=1, lexicographical order isequivalent to the normal ordering. Therefore, the task, in oneembodiment, of the sorting module 109 is to sort the rows ofsub-matrices of D using lexicographical ordering.

Let D′εR^(m×l) be a sub-matrix of DεR^(m×n). A sorting of the rows of D′is specified in a ranking vector LεR^(m), where L_(i)<L_(j) implies thatrow i comes before row j in D′ in lexicographic order. Stateddifferently, each row is assigned a rank of 0 to n−1, where ties areallowed. This also allows for L_(i)=L_(j), implying row i and j of D′are equal. For example, FIG. 2 shows one example of an input matrix D200, with rows m indexed {0, . . . , 9} and columns n indexed{0, . . . ,4}. FIG. 3 shows a matrix D′ 300 that gives the rows of matrix D 200sorted lexicographically after a sorting operation performed by thesorting module 109, where the ranking vector of D′ is L′:=[6, 5, 0, 5,2, 4, 7, 3, 1, 4]^(T). FIG. 4 shows a matrix D″ 400 that gives the rowsof D sorted lexicographically restricted to columns {0, 3, 4} after asorting operation performed by the sorting module 109, where the rankingvector of D″ is L″:=[4, 3, 0, 3, 2, 2, 5, 4, 1, 2]^(T). FIG. 5 shows amatrix D′″ 500 that gives the rows of D sorted lexicographicallyrestricted to columns {0, 3} after a sorting operation performed by thesorting module 109, where the ranking vector of D′″ is L′″:=[2, 2, 0, 2,1, 1, 3, 2, 1, 1]^(T). It should be noted that the sorting module 109can also compute the counts of occurrences of each unique row of thesorted matrices in time linear in the number of rows.

In one embodiment, the sorting module 109 sorts a sub-matrix (by rows)of an input matrix D restricted to a set of columns (attributes) of Dutilizing an initial sorting of the columns of D. In this embodiment,each column of D is independently sorted. The results of this initialsorting of columns in D is stored in a matrix QεZ₊ ^(m×n) where the j thcolumn Q_(j) of Q stores the row indices {0, . . . , m} after sortingthe j th column D_(i) of D. That is, Q_(j) is one-line Cauchy notationof the permutation of the row indices which sort the column vectorD_(j). FIG. 6 shows one example of a matrix Q 600 for the matrix D shownin FIG. 2.

FIG. 7 shows one example of pseudocode 700 for performing the abovesorting of a sub-matrix of an input matrix D. In this embodiment, thesorting module 109 receives as input a matrix DεR^(m×n), a matrixQεZ^(m×n), and {α_(p), . . . , α_(p)}⊂ {0, . . . , n−1}, which is aselection of columns to be sorted and their rows (i.e., a sub-matrix ofD). It should be noted that the Q matrix can be provided by an externalsource such as a user, application, etc., or can be generated by thesorting module 109. The sorting module 109 ensures that L′εZ^(m). Thesorting module 109, in this embodiment, sorts by iteratively increasingthe number of attributes, until the desired set of attributes isreached. That is, the sorting module 109 preforms a sort refiningoperation to refine the current sort with respect to columns {α₁, . . ., α_(j)} to give a sort with respect to the columns {a₁, . . . ,α_(j+1)}. The sorting module 109 then outputs a ranking vector L′, whichcomprises the sorting of the rows of matrix D with respect to thecolumns selected by the user. For example, FIG. 4 shows one example of asub-matrix 400 sorted based on the above sorting operation with L′=[4,3, 0, 3, 2, 2, 5, 4, 1, 2]^(T).

FIG. 8 shows one example of pseudocode 800 for the sort refiningoperation performed by the sorting module 109. When performing the sortrefining operation the sorting module 109 takes as input the matrix D[D], the sorting of the columns of D [Q], the column (attribute) torefine L by [i], and the current sorting [L]. The sort refiningoperation returns the refined vector L′. That is, if the input Lrepresents the sorting of the rows of D (restricted to some unknowncolumns), the returned value of L′ represents the refined sorting whereappending the ith column of D is considered. Again, if the input Lrepresents the lexicographical sorting of

$D^{\prime} = {\begin{matrix}0 \\1 \\\vdots \\n\end{matrix}\begin{matrix}{j_{0}\mspace{14mu} \ldots \mspace{14mu} j_{p}} \\\begin{pmatrix}* & \ldots & * \\* & \ldots & * \\\vdots & \ddots & \vdots \\* & \ldots & *\end{pmatrix}\end{matrix}}$

the output L′ is the lexicographical sorting of

$D^{''} = {\begin{matrix}0 \\1 \\\vdots \\n\end{matrix}\begin{matrix}\begin{matrix}j_{0} & \ldots & j_{p} & i\end{matrix} \\{\begin{pmatrix}* & \ldots & * & D_{0i} \\* & \ldots & * & D_{1i} \\\vdots & \ddots & \vdots & \; \\* & \ldots & * & D_{ni}\end{pmatrix}.}\end{matrix}}$

In more detail, the sort refining operation performed by the sort module109 takes as input a real m×n matrix D, an integral m×n matrix Q, aninteger i between 0 and n−1, and a m length integer vector L (rankingvector). D is the original input matrix, Q is a matrix in which everycolumn of Q gives the sorting of the corresponding column in D, i is thecolumn of D to consider when refining the ranking vector L, and L isassumed to be a ranking vector of some sorting of the rows of D. Theoutput of the sort refining operation is an integral vector L′ (rankingvector). In one embodiment, L′ is a refinement of the sort given by L,where the refinement is determined by the i th column of D. That is, ifL is the ranking vector of a sort of some (unobserved) hypotheticalsub-matrix D′ of D, then L′ is the ranking vector of the sorting of D′with the i th column of D appended to the right column. Here, the term“refinement” indicates that the i th column of D is used to break anyranking ties in the input ranking vector L.

Initially, the sorting module 109 initializes the ranking vector L′ tobe an m vector of all zeros. A first memory structure, IDval, isinitialized to be an m vector of all zeros. The j th position of IDvalrecords the most recently observed value in the i th column of D withrank j, where the rank is determined by ranking vector L. A secondmemory structure, IDvalInit, is also initialized to be an m vector ofall zeros. The j th entry in IDvalInit is 0 if an entry of L of rank jhas not yet been observed, otherwise it is1. A third memory structure,subID, is also initialized to be an m vector of all zeros. The memorystructure subID records the sub-ranking of each row of D. Initially allrows have the same sub-ranking. A fourth memory structure, newCount, isalso initialized to be an m vector of all zeros. The j entry in newCountrecords the number of times ties of all rows of rank j (rank determinedby L) are able to be broken when considering refining L using the i thcolumn of D.

The sorting module 109 loops over all rows of D, i.e. let j vary from 0to m−1. For example, consider a sub-matrix D′″ comprising columns 0 and3 of matrix D of FIG. 4. The sorting module 109 loops over all rows of Dfor each of the columns 0 and 3. Recall Q[j,i] is the row of the j thordered entry of column i of D. Then L[Q[j,i]] is the ranking of the rowQ[j,i], where L initially comprises all zeros. The sorting module 109selects rows based on Q. Using Q of FIG. 6 as an example the sortingmodule 109 first selects row 2 of D since row 2 is in the 0^(th) row ofcolumn 0 in Q. If IDvalInit[L[Q[j,i]]] is 0, that is if this is thefirst time the sorting module 109 has observed an item of rankingL[Q[j,i]], which is 0 in this example, then the sorting module 109 marksthat it has observed an item of ranking L[Q[j,i]]. That is, the sortingmodule 109 sets IDvalInit[L[Q[j,i]]]=1.

The sorting module 109 records the value of row Q[j,i] and column i of Das the most recently observed item of rank L[Q[j,i]]. That is, thesorting module 109 sets IDval[L[Q[j,i]]]=D[Q[j,i],i]. In the currentexample, the sorting module 109 sets IDval[L[Q[j,i]]]=0 since the valueof row 2 in D of FIG. 4 under column 0 is 0. Otherwise, ifIDvalInit[L[Q[j,i]]] is 1, that is if this is not the first time thesorting module 109 has observed an item of ranking L[Q[j,i]] then the ifthe value of row Q[j,i] and column i of D does equal the most recentlyobserved value of item with rank L[Q[j,i]] (IDval[L[Q[j,i]]]) then thesorting module 109 records the value of row Q[j,i] and column i of D asthe most recently observed item of rank L[Q[j,i]]. That is, the sortingmodule 109 sets IDval[L[Q[j,i]]]=D[Q[j,i], i].

For rank L[Q[j,i]], the sorting module 109 increases (by one) the numberof times the value of the most recently recorded item of rank L[Q[j,i]]changed. That is, the sorting module 109 setsnewCount[L[Q[j,i]]]:=newCount[L[Q[j,i]]]+1. The sorting module 109 setsthe sub-ranking of row Q[j,i] to be equal to the number of times themost recently recorded item of rank L[Q[j,i]] changed. That is, thesorting module 109 sets subID[Q[j,i]]=newCount[L[Q[,j i]]]. The sortingmodule 109 also sets the current offset to be zero. That is, the sortingmodule 109 sets curOffset=0. The sorting module 109 loops over 0 to m−1,i.e. let j=0, . . . , m−1. The sorting module 109 sets a memorystructure, temp, to be equal to the number of times the most recentlyrecorded item of rank j changed. That is, the sorting module 109 setstemp=newCount[j]. The sorting module 109 sets newCount[j] equal to thecurOffset, and increases curOffset by temp. Now the j position ofnewCount is the cumulative sum of all strictly previous values ofnewCount. The sorting module 109 loops over 0 to m−1, i.e. let j=0, . .. , m−1. The sorting module 109 sets L′[j] to be L[j] plus newCount[L[j]plus subID[j], and outputs L′ to a user.

As can be seen from the above, the sort refining operation selects a rowin D, where the row is selected based on Q, the value of the row underthe current column (e.g., column 0) in D is used to determine the rankof the given row. However, if there is a tie between two or more rows asub-ranking is assigned to the rows based on the value of the row underthe ith column (e.g., column 3) of D is used to break the tie. Ifadditional columns are not available to break a tie then tied rows canbe assigned the same rank. The output of the sort refining operation isa refinement of L. For example, the output of the sort refiningoperation for the sub-matrix D′″ of FIG. 5 is L′″:=[2, 2, 0, 2, 1, 1, 3,2, 1, 1]^(T)

In addition to the performing a sort on a single sub-matrix of an inputmatrix D, the sorting module 109 can also perform multiple sorts ofnested or related sub-matrices. In this embodiment, let DεR^(m×n) be areal matrix. For every sub-matrix D′ of D, D′ is sorted in lexicographicorder where the columns are taken in their natural order. For example,if D has columns {1, 2, 3, 4}, the task is to sort all sub-matrices of Dgiven by columns {1}, {2}, {3}, {4}, {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2,4}, {3, 4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}, and {1, 2, 3,4}.

FIG. 9 shows one example of pseudocode 900 for performing multiple sortsof nested or related sub-matrices. In particular, the pseudocode 900 ofFIG. 9 shows that the sorting module 109 receives as input a real m×nmatrix D, an integral m×n matrix Q, a subset of integers B between 0 andm−1, and a m length integer vector L (ranking vector). The output ofthis sorting operation is an integral vector L′ for each sub-matrix ofD, where the columns are taken in their natural order. When performingthis sorting operation the sorting module 109 explores all possiblesub-matrices (while taken the columns in their natural order) using adepth-first-search approach and constantly refining the ranking vectorthat stores the current sort utilizing the sort refining operationdiscussed above with respect to FIG. 8. It should be noted that theintegral vector L′ determined for a sub-matrix is used as an input for asubsequent related sub-matrix, thereby saving computational resourcesand time. For example, if matrix D has columns {1, 2, 3, 4} where thenatural order of the columns is {1, 2} and {1, 3}, the integral vectorL′ determined for sub-matrix {1, 2} is used as an input for the sortrefining operation of FIG. 8 to determine the integral vector forsub-matrix {1, 3}.

It should be noted that a lexicographical sort depends on the order ofthe columns. That is, the order of the rows of D sortedlexicographically may be different than the order of the rows of D′sorted lexicographically where D′ is the same as D, but with a differentpermutation of the columns. For example, consider the matrix D of FIG.2. FIGS. 10-11 show examples of lexicographical sortings 1000, 1100 ofD, where the columns have been permuted. This gives different orderingsof the rows of D.

Therefore, the sorting module 109, in one embodiment, also sorts allsub-matrices of D over all permutations of columns. For example, letDεR^(m×n) be a real matrix. For every sub-matrix D′ of D, the sortingmodule 109 sorts D′ in lexicographic order where the order of thecolumns of D′ are used. It is not sufficient to simply use theterminology “set” when the order matters. When the order of a setmatters the terminology “ordered set” is used. Thus, {1, 2, 3} is adifferent ordered set than {2, 3, 1}, but they are equal as sets.

FIG. 12 shows one example of pseudocode 1200 for sorting of allsub-matrices of D over all permutations of columns. In particular, thepseudocode 1200 of FIG. 12 shows that the sorting module 109 receives asinput a real m×n matrix D, an integral m×n matrix Q, a subset ofintegers B between 0 and m−1, and a m length integer vector L (rankingvector). The output of this sorting operation is an integral vector L′for each sub-matrix of D, where column order matters. When performingthis sorting operation the sorting module 109 explores all possiblesub-matrices (column order dependent) using a depth-first-searchapproach and constantly refining the L vector, which stores the currentsort, utilizing the sort refining operation discussed above with respectto FIG. 8. It should be noted that the integral vector L′ determined fora sub-matrix is used as an input for a subsequent related sub-matrix,thereby saving computational resources and time.

The sorting operations discussed above outperform basic comparisonsorting operations. For example, consider the task of sorting Drestricted to all possible choices of attributes. For DεR^(m×n), thereare 2^(n) choices of attributes. A basic comparison-sort sortingalgorithm would require at least O(mlog(m)2^(n)) time. The sortingoperations performed by the sorting module 109 only requiresO(mlog(m)+m2^(n)), a reduction by a log factor of m. This is due to thefact that the sorting module 109 can be used to save many computationsby exploring all choices of attributes in increasing cardinality.Moreover, the space requirement is only linear O(m).

Some conventional sorting operations require the computation ofcontingency tables. However, the time and space requirements to computethe required data structures for contingency tables can be enormous. Forexample, consider the ADtree method for computing contingency tables,assuming binary attributes (attributes only take two values), the costto build an ADtree is bounded above by

${\sum\limits_{k = 0}^{\lfloor{\log_{2}{(m)}}\rfloor}{\frac{m}{2^{k}}n_{k}}},$

where DεR^(m×n). If all possible combinations of the binary attributesappear in D, the space requirement would be 2^(n). Even with areasonable number of rows the space requirement would be bound above by

$\sum\limits_{k = 0}^{\lfloor{\log_{2}{(m)}}\rfloor}{n_{k}.}$

The time and space requirements can become practically prohibitive as nand m grow. For example, constructing and storing the ADtree for adataset DεR^(1000×50000) would be infeasible. By contrast, the sortingoperations performed by the sorting module 109 only require linear spaceand time for each sort.

One or embodiments discussed above can be used to efficiently andaccurately sort data for a wide variety of applications. For example,Bayesian networks are graphical models that have applications in a manyareas including machine learning, statistical inference, finance,biology, artificial intelligence, etc. At the core, learning a Bayesiannetwork requires taking the input DεR^(m×n) and computing contingencytables of D restricted to subsets of columns. In some situations, onemay have to compute contingency tables for all possible subsets ofcolumns of D. If m and n become large, it may be prohibitive to computeand store elaborate data structures. However, the sorting mechanism ofone or more embodiments discussed above can quickly sort these subsetsof columns while utilizing minimal memory resources.

For example, Bayesian networks can model epistasis, the interaction ofmultiple genes to produce a phenotype. Consider the genotypes for 1,000individuals with 50,000 single nucleotide polymorphisms (SNPs) and somephenotype (disease/no-disease). Then DεR^(1000×50001). The task ofdetecting k-way epistasis using Bayesian networks reduces to computingcontingency tables (sorting) all possible choices of k subsets columnsof D. Considering the ADtree equations discussed above, using ADtrees isnot feasible. However, the sorting mechanism of one or more embodimentsdiscussed above requires linear time and space, to check each choice ofk columns of D.

FIG. 13 is an operational flow diagram illustrating one example ofefficiently sorting large dimensional data. The operational flow diagrambegins at step 1302 and flows directly to step 1304. The sorting module109, at step 1304, receives receiving a matrix D that includes a set ofdata values. The matrix D comprises a set of rows and a set of columns.The sorting module 109, at step 1306, receives a matrix Q that includesa set of columns and a set of rows. The matrix Q further includes asorting of each column of the matrix D. Each the set of rows in thematrix Q corresponds to a sorting rank, and each of a set of values ineach of the set of columns in the matrix Q identifies a row in thematrix D.

The sorting module 109, at step 1308, identifies at least one sub-matrixD′ of the matrix D. The at least one sub-matrix D′ includes a set ofrows and a set of columns. The set of columns in the sub-matrix D′ isrestricted to one or more columns in the matrix D. The sorting module109, at step 1310, sorts the at least one sub-matrix D′ by rows based onthe sorting of the set of columns of the matrix D as given in the matrixQ, and the set of data values in the matrix D. The control flow thenexits at step 1312.

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method, or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention have been discussed above withreference to flowchart illustrations and/or block diagrams of methods,apparatus (systems) and computer program products according to variousembodiments of the invention. It will be understood that each block ofthe flowchart illustrations and/or block diagrams, and combinations ofblocks in the flowchart illustrations and/or block diagrams, can beimplemented by computer program instructions. These computer programinstructions may be provided to a processor of a general purposecomputer, special purpose computer, or other programmable dataprocessing apparatus to produce a machine, such that the instructions,which execute via the processor of the computer or other programmabledata processing apparatus, create means for implementing thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

The description of the present invention has been presented for purposesof illustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. An information processing system for sortingdata, the information processing system comprising: a memory; aprocessor communicatively coupled to the memory; and a sorting modulecommunicatively coupled to the memory and the processor, wherein thesorting module is configured to perform a method comprising: receiving amatrix D comprising a set of data values, wherein the matrix D comprisesa set of rows and a set of columns; receiving a matrix Q comprising aset of columns and a set of rows, wherein the matrix Q further comprisesa sorting of each column of the matrix D, wherein each of the set ofrows corresponds to a sorting, and wherein each of a set of values ineach of the set of columns identifies a row in the matrix D; identifyingat least one sub-matrix D′ of the matrix D, wherein the at least onesub-matrix D′ comprises a set of rows and a set of columns, where theset of columns is restricted to one or more columns of the matrix D; andsorting, by a processor, the at least one sub-matrix D′ by rows based onthe sorting of the set of columns of the matrix D as given in the matrixQ, and the set of data values in the matrix D.
 2. The informationprocessing system of claim 1, wherein the sorting comprises: generatinga ranking vector L comprising a sorting of each row of the sub-matrixD′, where L_(i)<L_(j) indicates that row i comes before row j in the atleast one sub-matrix D′ in lexicographic order, and where L_(i)=L_(j),indicates row i and row j of the at least one sub-matrix D′ are equal.3. The information processing system of claim 2, wherein the methodfurther comprises: identifying at least one additional sub-matrix D″ ofthe matrix D, wherein the at least one additional sub-matrix D″comprises a set of rows and a set of columns, where the set of columnsis restricted to one or more columns of the matrix D; and sorting the atleast one additional sub-matrix D″ by rows based on the sorting of theset of columns of the matrix D as given in the matrix Q, and the rankingvector L generated for the sub-matrix D′.
 4. The information processingsystem of claim 3, wherein the at least one sub-matrix D′ and the atleast one additional sub-matrix D″ are each restricted to one or morecolumns in the matrix D taken in their natural order in the matrix D. 5.The information processing system of claim 3, wherein an order of theset of columns in each of the at least one sub-matrix D′ andcollectively correspond to all possible permutations of columns in thematrix D.
 6. The information processing system of claim 1, wherein thesorting comprises: selecting a column in the matrix Q corresponding to afirst column of the sub-matrix D′; selecting, in order, each row in theselected column; identifying, for each selected row, a row in the matrixD based on the value in the selected column corresponding to theselected row; identifying, for each identified row in the matrix D, adata value in a column in the matrix D corresponding to the selectedcolumn at the identified row; and determining, for each row in thesub-matrix D′, a sorting rank based on the identified data values in thecolumn of matrix D.
 7. The information processing system of claim 6,wherein the determining further comprises: determining that at least twoof the rows in the sub-matrix D′ are associated with an identical datavalue; selecting, based on the determining, at least one additionalcolumn in the matrix Q corresponding to at least a second column of thesub-matrix D′; selecting, in order, each row in the at least oneadditional column; identifying, for each selected row, a row in thematrix D based on the value in the at least one additional columncorresponding to the selected row; identifying, for each identified rowin the matrix D, a data value in at least one additional column in thematrix D corresponding to the at least one additional column in thematrix Q at the identified row; and determining, for each row in thesub-matrix D′, the sorting rank based on the identified data values inthe at least one additional column of matrix D.
 8. A non-transitorycomputer program product for sorting data, the computer program productcomprising: a storage medium readable by a processing circuit andstoring instructions for execution by the processing circuit forperforming a method comprising: receiving a matrix D comprising a set ofdata values, wherein the matrix D comprises a set of rows and a set ofcolumns; receiving a matrix Q comprising a set of columns and a set ofrows, wherein the matrix Q further comprises a sorting of each column ofthe matrix D, wherein each of the set of rows corresponds to a sortingrank, and wherein each of a set of values in each of the set of columnsidentifies a row in the matrix D; identifying at least one sub-matrix D′of the matrix D, wherein the at least one sub-matrix D′ comprises a setof rows and a set of columns, where the set of columns is restricted toone or more columns of the matrix D; and sorting, by a processor, the atleast one sub-matrix D′ by rows based on the sorting of the set ofcolumns of the matrix D as given in the matrix Q, and the set of datavalues in the matrix D.
 9. The non-transitory computer program productof claim 8, wherein the sorting comprises: generating a ranking vector Lcomprising a sorting of each row of the sub-matrix D′, where L_(i)<L_(j)indicates that row i comes before row j in the at least one sub-matrixD′ in lexicographic order, and where L_(i)=L_(j), indicates row i androw j of the at least one sub-matrix D′ are equal.
 10. Thenon-transitory computer program product of claim 9, wherein the methodfurther comprises: identifying at least one additional sub-matrix D″ ofthe matrix D, wherein the at least one additional sub-matrix D″comprises a set of rows and a set of columns, where the set of columnsis restricted to one or more columns of the matrix D; and sorting the atleast one additional sub-matrix D″ by rows based on the sorting of theset of columns of the matrix D as given in the matrix Q, and the rankingvector L generated for the sub-matrix D′.
 11. The non-transitorycomputer program product of claim 10, wherein the at least onesub-matrix D′ and the at least one additional sub-matrix D″ are eachrestricted to one or more columns in the matrix D taken in their naturalorder in the matrix D.
 12. The non-transitory computer program productof claim 10, wherein an order of the set of columns in each of the atleast one sub-matrix D′ and collectively correspond to all possiblepermutations of columns in the matrix D.
 13. The non-transitory computerprogram product of claim 8, wherein the sorting comprises: selecting acolumn in the matrix Q corresponding to a first column of the sub-matrixD′; selecting, in order, each row in the selected column; identifying,for each selected row, a row in the matrix D based on the value in theselected column corresponding to the selected row; identifying, for eachidentified row in the matrix D, a data value in a column in the matrix Dcorresponding to the selected column at the identified row; anddetermining, for each row in the sub-matrix D′, a sorting rank based onthe identified data values in the column of matrix D.
 14. Thenon-transitory computer program product of claim 13, wherein thedetermining further comprises: determining that at least two of the rowsin the sub-matrix D′ are associated with an identical data value;selecting, based on the determining, at least one additional column inthe matrix Q corresponding to at least a second column of the sub-matrixD′; selecting, in order, each row in the at least one additional column;identifying, for each selected row, a row in the matrix D based on thevalue in the at least one additional column corresponding to theselected row; identifying, for each identified row in the matrix D, adata value in at least one additional column in the matrix Dcorresponding to the at least one additional column in the matrix Q atthe identified row; and determining, for each row in the sub-matrix D′,the sorting rank based on the identified data values in the at least oneadditional column of matrix D.